/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.treeeditpart;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.uml2.uml.Element;

import com.cea.papyrus.core.editor.ModelManager;
import com.cea.papyrus.core.utils.Debug;



/**
 * 
 */
class ModelManagerTreeEditPart extends CommonTreeEditPart
implements PropertyChangeListener {

	/**
	 * 
	 */
	private int channel = 20;
	
	/**
	 * Create a new instance of this edit part using the given model element.
	 * 
	 * @param element a non-null ShapesDiagram instance
	 */
	ModelManagerTreeEditPart(ModelManager element) {
		super(element, element);
		Debug.debug(this,"ModelManagerEditPartCreate!", channel);
		
	}

	/**
	 * Upon activation, attach to the model element as a property change listener.
	 */
	@Override
	public void activate() {
		if (!isActive()) {
			super.activate();
		}
	}

	/**
	 * 
	 * 
	 * @return the ModelManager associated to this treeEditPart
	 */
	@Override
	public ModelManager getModelManager(){
		return modelManager;
	}

	/**
	 * Upon deactivation, detach from the model element as a property change listener.
	 */
	@Override
	public void deactivate() {
		if (isActive()) {
			super.deactivate();
//			((ItfModelElement) getModel()).removePropertyChangeListener(this);
		}
	}

	/* (non-Javadoc)
	 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
	 */
	/**
	 * 
	 * 
	 * @param evt 
	 */
	public void propertyChange(PropertyChangeEvent evt) {
		String prop = evt.getPropertyName();
	}

	/* (non-Javadoc)
	 * @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
	 */
	/**
	 * 
	 * 
	 * @return 
	 */
	@Override
	protected List<Element> getModelChildren() {
		ArrayList<Element> contained= new ArrayList<Element>();
		contained.add(modelManager.getTopPackageFromUMLResource());
		return contained;
	}
}